package teacher.action;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.opensymphony.xwork2.ActionSupport;

import teacher.bean.Award;
import teacher.bean.Flow;
import teacher.bean.Treatise;
import teacher.service.flow;
import teacher.service.treatise;
import tools.StringDate;

public class modifyTre extends ActionSupport{
	private Treatise tre;
	private int treatiseId;

	public int getTreatiseId() {
		return treatiseId;
	}

	public void setTreatiseId(int treatiseId) {
		this.treatiseId = treatiseId;
	}

	public Treatise getTre() {
		return tre;
	}

	public void setTre(Treatise tre) {
		this.tre = tre;
	}
	
	public String execute(){
		
		tre=new treatise().selectTreatiseById(treatiseId);
//		流程管理部分
		Treatise a=new Treatise();
		a=new flow().selectTreatiseByName(this.getTre().getName());
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Flow f=new Flow();
		f.setFruitId(a.getTreId());
		f.setFruitKind(2);
		f.setDirDo(2);
		f.setDirTime(df.format(new Date()));
		f.setSubDo(2);
		f.setSubTime(df.format(new Date()));
		f.setTeaDo(3);
		f.setTeaTime(df.format(new Date()));
//		流程管理结束
		if(new flow().insertFlow(f)){
			return SUCCESS;
		}else{
			return SUCCESS;
		}
		
	} 

}
